package fermat_test

import "math"

type tSimplePrimeTester struct {
}

func newSimplePrimeTester() IPrimeTester {
	return &tSimplePrimeTester{}
}

func (me *tSimplePrimeTester) IsPrime(x int) bool {
	if x <= 1 {
		return false
	}

	if x <= 3 {
		return true
	}

	for i, q := 2,int(math.Floor(math.Sqrt(float64(x))));i <= q;i++ {
		if x % i == 0 {
			return false
		}
	}

	return true
}


var SimplePrimeTester = newSimplePrimeTester()